#ifndef NOTEWIDGET_H
#define NOTEWIDGET_H

#include <QFrame>
#include <QColor>

namespace Ui {
class NoteWidget;
}

class NoteWidget : public QFrame
{
	Q_OBJECT
	
public:
	explicit NoteWidget(QWidget *parent = 0, QByteArray docHash = QByteArray(), int id = -1);
	~NoteWidget();

	int getId();

	static QVector<QColor> getDefaultColors();
	QColor getBgColor();

	QString getTitle();

signals:
	void deleteNoteRequested(QByteArray docHash, int id);
	void titleChanged(QByteArray docHash, int id, QString title);
	void textChanged(QByteArray docHash, int id, QString text);
	void posChanged(QByteArray docHash, int id, QPoint pos);
	void colorChanged(QByteArray docHash, int id, QColor color);
	void maximizedChanged(QByteArray docHash, int id, bool value);
	void maximumSizeChanged(QByteArray docHash, int id, QSize size);

public slots:
	void setTitle(QString title);
	void setText(QString text);
	void setColor(QColor color);
	void setPos(QPointF normPos);
	QPointF getPos();
	void setMaximized(bool value);
	void setPageNumber(int value);
	int getPageNumber();

protected slots:
	void on_checkMaximize_toggled(bool checked);
	void on_textEdit_textChanged();
	void on_btnDeleteNote_clicked();
	void setHovered(bool value);
	void setTransparency(bool transparent);
	void setBgColor(QColor color);

protected:
	bool eventFilter(QObject *obj, QEvent *event);
	void enterEvent(QEvent *);
	void leaveEvent(QEvent *);
	void myAdjustSize();

protected slots:
	void on_btnPickBgColor_clicked();
	void on_lineEdit_textChanged(const QString &arg1);

protected:
	Ui::NoteWidget *ui;
	QByteArray docHash;
	int id;
	int pageNumber;

	QPointF normPos;
	QPoint mousePressPos;
	QPoint mousePressWidgetPos;
	QSize mousePressWidgetSize;
	QColor bgColor;
private slots:
	void on_btnBold_toggled(bool checked);
	void on_textEdit_currentFontChanged(const QFont &f);
	void on_btnItalic_toggled(bool checked);
	void on_btnUnderline_toggled(bool checked);
	void on_btnStrikethrough_toggled(bool checked);
	void on_btnMonospace_toggled(bool checked);
	void on_btnSubscript_toggled(bool checked);
	void on_btnSuperscript_toggled(bool checked);
	void on_btnPickTextColor_clicked();
};

#endif // NOTEWIDGET_H
